<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

//获取站点配置信息
function getWebset($name = '')
{
    $data = app\common\model\Webset::getWebset();
    if (!empty($data[$name])) {
        return $data[$name];
    } else {
        return '';
    }
}

//获取当前分类的cid值
function getCurrenCid()
{
    return input('cid', '');
}

//获取当前用户所在的组
function getCurrenAuthGroup($id)
{
    $auth = think\auth\Auth::instance();
    $authGroups = $auth->getGroups($id);
    $authGroupArr = [];
    foreach ($authGroups as $authGroup) {
        $authGroupArr[] = $authGroup['title'];
    }
    return implode(',', $authGroupArr);
}

//获取当前组(角色)所有的权限
function getGroupAuths($rules)
{
    $datas = app\common\model\Authrule::where('id', 'in', $rules)->column('title');
    return implode(',', $datas);
}

